﻿//  -------------------- iSharePoint -------------------- //
// 
//  Company:	IT Complex, LLC
//  Project:	Smart.Common
//  File name:	IRouterFactory.cs
//  Developer:	Solomatov Igor
//  Created:	15.04.2012
// 
//  -------------------- iSharePoint -------------------- //

namespace Smart.Common.Router
{
	/// <summary>
	/// Router factory
	/// </summary>
	public interface IRouterFactory
	{
		/// <summary>
		/// Get router service by router type name
		/// </summary>
		IRouterService GetService(string routerServiceName);

		/// <summary>
		/// Ensure that uri corresponds to the real path
		/// </summary>		
		/// <returns>True if uri exists, false otherwise.</returns>
		bool EnsureUriExists(string routerServiceName, string uri);

		/// <summary>
		/// Get formatted uri and template type by name
		/// </summary>
		string GetUri(string routerServiceName, string name, out string type, params object[] values);

		/// <summary>
		/// Get formatted uri
		/// </summary>
		string GetUri(string routerServiceName, string name, params object[] values);

		/// <summary>
		/// Get object specified by name and values
		/// </summary>
		object Get(string routerServiceName, string name, params object[] values);

		/// <summary>
		/// Get templated object specified by name and values
		/// </summary>
		TObjectType Get<TObjectType>(string routerServiceName, string name, params object[] values)
			where TObjectType : class;

		/// <summary>
		/// Add or update template
		/// </summary>
		bool AddOrUpdateTemplate(string routerServiceName, RouterTemplate template);
	}
}